"""
RAG系统通用数据结构
"""

from typing import Dict, Any, List
from dataclasses import dataclass


@dataclass
class RetrievalResult:
    """检索结果数据结构"""
    content: str
    score: float
    source: str = ""
    metadata: Dict[str, Any] = None
    retrieval_type: str = "semantic"  # semantic, bm25, metadata

    def __post_init__(self):
        if self.metadata is None:
            self.metadata = {}


@dataclass
class QueryContext:
    """查询上下文"""
    original_query: str
    rewritten_queries: List[str]
    conversation_history: str
    session_id: str
    user_id: str
    query_type: str = "general"  # general, follow_up, clarification
